package com.workplan.client.modules.staff;

import net.customware.gwt.presenter.client.EventBus;
import net.customware.gwt.presenter.client.widget.WidgetPresenter;

import com.workplan.client.widgets.createemployee.CreateEmployee;
import com.workplan.client.widgets.createemployee.CreateEmployeePresenter;
import com.workplan.client.widgets.createemployee.CreateEmployeePresenterImpl;
import com.workplan.client.widgets.currentemployees.CurrentEmployees;
import com.workplan.client.widgets.currentemployees.CurrentEmployeesPresenter;
import com.workplan.client.widgets.currentemployees.CurrentEmployeesPresenterImpl;
import com.workplan.client.widgets.pastemployees.PastEmployees;
import com.workplan.client.widgets.pastemployees.PastEmployeesPresenter;
import com.workplan.client.widgets.pastemployees.PastEmployeesPresenterImpl;

public class AssembleStaffPresenterImpl extends
		WidgetPresenter<AssembleStaffPresenter.Display> implements
		AssembleStaffPresenter {

	private final CreateEmployeePresenter.Display createEmployee = new CreateEmployee();
	private final CreateEmployeePresenter createEmployeePresenter;

	private final CurrentEmployeesPresenter.Display currentEmployees = new CurrentEmployees();
	private final CurrentEmployeesPresenter currentEmployeesPresenter;

	private final PastEmployeesPresenter.Display pastEmployees = new PastEmployees();
	private final PastEmployeesPresenter pastEmployeesPresenter;

	public AssembleStaffPresenterImpl(Display display, EventBus eventBus) {
		super(display, eventBus);
		createEmployeePresenter = new CreateEmployeePresenterImpl(
				createEmployee, eventBus);
		currentEmployeesPresenter = new CurrentEmployeesPresenterImpl(
				currentEmployees, eventBus);
		pastEmployeesPresenter = new PastEmployeesPresenterImpl(pastEmployees,
				eventBus);

	}

	@Override
	protected void onBind() {
		createEmployeePresenter.bind();
		display.setCreateEmployee(createEmployeePresenter.getDisplay());
		currentEmployeesPresenter.bind();
		display.setCurrentEmployees(currentEmployees);
		pastEmployeesPresenter.bind();
		display.setPastEmployees(pastEmployeesPresenter.getDisplay());
		display.init();
	}

	@Override
	protected void onUnbind() {
		createEmployeePresenter.unbind();
		currentEmployeesPresenter.unbind();
	}

	@Override
	protected void onRevealDisplay() {
	}

}
